Skip to content

fix: use parallel config value from configuration file#18

Merged
inureyes merged 1 commit into
mainfrom
fix/parallel-config-support
Aug 27, 2025
Merged

fix: use parallel config value from configuration file#18
inureyes merged 1 commit into
mainfrom
fix/parallel-config-support

Conversation

@inureyes
Copy link
Copy Markdown
Member

@inureyes inureyes commented Aug 27, 2025

Summary

  • Fixed the issue where parallel configuration values were completely ignored
  • Implemented proper config file support for the parallel option

Problem

The parallel field existed in config files but was never actually used. The application always used CLI's default value (10) regardless of config settings.

# This was ignored:
defaults:
  parallel: 50

Solution

  • Added get_parallel() method to Config struct (follows same pattern as get_timeout())
  • Added parallel field to ClusterDefaults struct for cluster-specific settings
  • Detect if user explicitly specified -p/--parallel in CLI arguments
  • Use config value when CLI option is not explicitly provided

Priority Order

  1. CLI option (if explicitly specified with -p or --parallel)
  2. Cluster-specific config (clusters.<name>.parallel)
  3. Global defaults config (defaults.parallel)
  4. CLI default value (10)

Usage Examples

# Global default
defaults:
  parallel: 50

# Cluster-specific override
clusters:
  production:
    nodes: [...]
    parallel: 100  # Use up to 100 parallel connections for production
  dev:
    nodes: [...]
    parallel: 5    # Limit to 5 for dev environment
# Uses config value (50 from defaults or cluster-specific)
bssh -c production "uptime"

# Overrides config with explicit CLI value
bssh -c production -p 200 "uptime"

Test Plan

  • Code builds successfully
  • Clippy checks pass
  • Code formatted with cargo fmt
  • Manual testing with config files
  • Verify CLI override still works
  • Verify cluster-specific parallel values work

Previously, the parallel setting in config files was completely ignored.
This fix implements proper config support for the parallel option:

- Add get_parallel() method to Config struct (follows same pattern as get_timeout)
- Add parallel field to ClusterDefaults struct
- Check if user explicitly specified -p/--parallel in CLI args
- Use config value when CLI option not explicitly provided
- Priority: CLI (if explicit) > Cluster config > Global defaults > CLI default (10)

Now users can set parallel in their config files:
  defaults:
    parallel: 50
  clusters:
    production:
      parallel: 100

Fixes the issue where config parallel values were defined but never used.
@inureyes inureyes added the type:bug Something isn't working label Aug 27, 2025
@inureyes inureyes self-assigned this Aug 27, 2025
@inureyes inureyes merged commit 2af9c4f into main Aug 27, 2025
3 checks passed
inureyes added a commit that referenced this pull request Aug 27, 2025
Resolve conflicts by keeping SSH compatibility features from main:
- SSH-compatible command-line interface (#25)
- Help message when no arguments provided (#20)
- Parallel config support fix (#18)

All functionality from both branches preserved including:
- SSH mode with interactive shell support
- Multi-server mode with parallel execution
- Proper argument parsing for SSH compatibility
- Configuration-based parallel limits
@inureyes inureyes added priority:medium Medium priority issue status:done Completed labels Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:medium Medium priority issue status:done Completed type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant